package middleware

import (
	"web_api_gin/core/logger"

	"github.com/gin-gonic/gin"
)

func LoadMiddleware(r *gin.Engine) {
	//跨域
	r.Use(Cors())
	r.Use(generateRequestId)

	r.Use(accessLog(logger.RequestLogger))

	r.Use(recoveryLog)
	//权限校验
	r.Use(checkPermission())
	//记录操作日志到数据表，方便后续追查操作来源
	r.Use(optLogRecord)
}
